﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SRQIDT.forms
{
    public partial class AddTaskSegment : Form
    {
        public AddTaskSegment()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
                MessageBox.Show("故障模式输入有误！", "提示！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            else
            {
                //添加到listview
                ListViewItem LVTS = new ListViewItem();
                LVTS.Text = Form1.TS_count.ToString();
                LVTS.SubItems.Add(textBox1.Text);
                LVTS.SubItems.Add(textBox2.Text);
                LVTS.SubItems.Add(textBox3.Text);
                Form1.new_TaskModeling.AddTSListItem(LVTS);
                Form1.TS_count++;
                //添加到TaskSegment数组(从0开始计数)
                int i = (Form1.TS_count - 1);
                Form1.TSA[i] = new Form1.TaskSegment();
                Form1.TSA[i].TS_id = textBox1.Text;
                Form1.TSA[i].TS_Name = textBox2.Text;
                Form1.TSA[i].Excuse_Time = double.Parse(textBox3.Text);
                Form1.TSA[i].TS_isselected = false;
                Form1.TSA[i].TS_isdeleted = false;
                this.Close();
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            this.Close();
        }
 
    }
}
